---
# tasks file for ansible-ansible-openshift-ansible
#

- name: Install required packages
  package: name="{{ item }}" state=present
  with_items:
    - ansible
    - git
    - pyOpenSSL
  tags:
  - ansible-ansible-openshift-ansible
  - ansible-ansible-openshift-ansible-config

- name: git clone the openshift-ansible repo
  git:
    repo: "https://github.com/openshift/openshift-ansible.git"
    dest: "{{ openshift_ansible_path }}"
    version: "{{ openshift_ansible_version }}"
  tags:
  - ansible-ansible-openshift-ansible
  - ansible-ansible-openshift-ansible-config

- name: generate the inventory file
  template:
    src: "cluster-inventory.j2"
    dest: "{{ openshift_ansible_path }}/{{ cluster_inventory_filename }}"
  tags:
  - ansible-ansible-openshift-ansible
  - ansible-ansible-openshift-ansible-config

- name: run ansible
  shell: "ansible-playbook {{ openshift_ansible_playbook }} -i {{ cluster_inventory_filename }}"
  args:
    chdir: "{{ openshift_ansible_path }}"
  register: run_ansible_out
  tags:
  - ansible-ansible-openshift-ansible

- name: display run ansible stdout_lines
  debug:
    var: run_ansible_out.stdout_lines
  tags:
  - ansible-ansible-openshift-ansible

- name: display run ansible stderr
  debug:
    var: run_ansible_out.stderr
  tags:
  - ansible-ansible-openshift-ansible
